package com.dayuanit.dy15.ebook.bookshop.util;

public class StringUtils {

    public static String formatPhone(String phone) {
        StringBuilder sx = new StringBuilder();

        for (int i=0; i< phone.length(); i++) {
            if (i >2 && i < phone.length() -3) {
                sx.append("*");
            } else {
                sx.append(phone.charAt(i));
            }
        }
        return sx.toString();
    }

    public static void main(String[] args) {
        System.out.println(formatPhone("18014890987"));
    }
}
